package net.bplaced.streetfighter.lib.service;

import java.util.ArrayList;
import java.util.List;

import net.bplaced.streetfighter.lib.utils.ServiceReturnPackage;

import org.apache.http.NameValuePair;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.message.BasicNameValuePair;

/**
 * @author Sebastian Hoffmann <bo.hoffi@googlemail.com>
 */
public class CommentPostServiceImpl
        extends CommonService<String> {

    public ServiceReturnPackage<String> postCommentViaPost(String author, String authorMail, String authorUrl,
            String authorIP, String commentText, String parentComment) {

        final HttpPost httppost = new HttpPost("http://streetfighter.bplaced.net/services/CommentPostPostService.php");

        final List<NameValuePair> parameters = new ArrayList<NameValuePair>(6);
        parameters.add(new BasicNameValuePair("author", author));
        parameters.add(new BasicNameValuePair("authorMail", authorMail));
        parameters.add(new BasicNameValuePair("authorUrl", authorUrl));
        parameters.add(new BasicNameValuePair("authorIP", authorIP));
        parameters.add(new BasicNameValuePair("commentText", commentText));
        parameters.add(new BasicNameValuePair("parentComment", parentComment));

        return this.sendRequest(httppost, parameters, String.class);
    }
}